package utils;

public class Point3D extends Coordinates {

    public Point3D(Point3D vec) {
	super(vec.getX(), vec.getY(), vec.getZ());
    }

    public Point3D(double[] cords) {
	super(cords[0], cords[1], cords[2]);
    }

    public Point3D(double x, double y, double z) {
	super(x, y, z);
    }

    public double distance(Point3D p) {
	double x = this.getX() - p.getX();
	double y = this.getY() - p.getY();
	double z = this.getZ() - p.getZ();
	return Math.sqrt(x * x + y * y + z * z);
    }

    public Point3D addVector(Vector v) {
	return new Point3D(this.getX() + v.getX(), this.getY() + v.getY(), this.getZ() + v.getZ());
    }

    public Point3D scale(double factor) {
	return new Point3D(this.getX() * factor, this.getY() * factor, this.getZ() * factor);
    }

    public Point3D addPoint(Point3D p) {
	return new Point3D(this.getX() + p.getX(), this.getY() + p.getY(), this.getZ() + p.getZ());
    }
}
